package lagou.homework.lagouhomework.Unit2.q3.code;

/**
 * 上网套餐类 特征：上网流量、每月资费 行为：显示所有套餐信息 
 * */
public  class NetPackage extends Packages implements NetService {
    private  int  netFlow;      // 上网流量
    // private  double charges;    // 每月资费  // 继承自Packages

    public NetPackage() {
    }


    public NetPackage(int netFlow, double charges) {
        super(charges);
        setNetFlow(netFlow);
    }

    public int getNetFlow() {
        return netFlow;
    }

    public void setNetFlow(int netFlow) {
        this.netFlow = netFlow;
    }



    /**  继承自Packages
    public double getCharges() {
        return charges;
    }

    public void setCharges(double charges) {
        this.charges = charges;
    }
*/

/**
    public void  showNetPackage(){
        System.out.println("本月上网套餐中上网流量为 "+ getNetFlow() + ",资费为:" + getCharges());
    }
 */
    @Override
    public void showInfo() {
        System.out.println("本月上网套餐流量为 "+ getNetFlow() + "M,资费为:" + getCharges());

    }
    @Override
    public void netService(int netFlow, PhoneCard phoneCard) {
        System.out.println("本次使用了"+ netFlow + "M流量");
        // 重新计算上网流量
        phoneCard.setNetFlow(phoneCard.getNetFlow()+netFlow);


    }
}
